﻿using Microsoft.Extensions.Configuration;
using MiniFox.Configurations;
using System;
using System.Collections.Generic;

using System.Linq;

using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace MiniFox.Log.Configurations
{
    /// <summary>
    /// 
    /// </summary>
    [Section(ELEMENT_NAME)]
    public class LoggerConfiguration
    {
        internal const string ELEMENT_NAME = "minifox:logger";

        /// <summary>
        /// 
        /// </summary>
        public LoggerConfiguration() { }

        /// <summary>
        /// 日志配置集合
        /// </summary>
        [ConfigurationKeyName("settings")]
        public LoggerSettingCollection LoggerSettings
        {
            get;
            set;
        } = new();
        /// <summary>
        /// 默认日志配置名称
        /// </summary>
        [ConfigurationKeyName("default")]
        public string Default
        {
            get;
            set;
        }
        /// <summary>
        /// 默认日志对象工厂类型名
        /// </summary>
        [ConfigurationKeyName("factory")]
        public string Factory
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        internal Type FactoryType
        {
            get
            {
                Type type = Type.GetType(this.Factory);
                return type;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("webContentFilters")]
        public string[] WebContentFilters
        {
            get;
            set;
        } = new string[] { };
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("exceptionUrls")]
        public string[] ExceptionUrls
        {
            get;
            set;
        } = new string[] { };
    }
}
